package com.goldwind.user.service.impl;

import com.goldwind.pojo.User;
import com.goldwind.pojo.Channel;
import com.goldwind.user.dao.UserMapper;
import com.goldwind.user.service.userService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class userService_impl implements userService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User selectByEmail(String email){
        return userMapper.selectByEmail(email);
    }

    @Override
    public List<User> selectAll(){
        return userMapper.selectAll();
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }

    @Override
    public List<Channel> selectChannel(int userId){return userMapper.selectChannel(userId);}

    @Override
    public int createChannel(Channel channel){return userMapper.createChannel(channel);}

    @Override
    public void concat(int userId){
        int cId=userMapper.selectNewChannel(userId);
        userMapper.concat(userId,cId);
    }

    @Override
    public List<Channel> findChannel(String sort){
        return userMapper.findChannel(sort);
    }

    @Override
    public List<Channel> suggestChannel(){
        return userMapper.suggestChannel();
    }

    @Override
    public List<Channel> loveChannel(int  userId){
        return userMapper.loveChannel(userId);
    }

    @Override
    public List<Channel> searchChannel(String name){
        return userMapper.searchChannel(name);
    }

    @Override
    public int entryChannel(int userId,int cId){
        return userMapper.concat(userId, cId);
    }

    @Override
    public List<Integer> addedChannels(int userId){return userMapper.addedChannels(userId);}
}
